## to include the current developing tkMD into tcl package search path. Wouldn't be needed for deploy.
set auto_path [concat [pwd]/../../pkg/tkMD $auto_path ]
## start of the program
package require tkMD 1.1
namespace import Data::*

## First, concatenate eql.sum under run1 have the same @pept but different @i and @orientation. 
# The variable values are parsed from the given path pattern run1/@pept/type_@type/run@i . 
# The concatenated files are saved in data folder.
set result [batch_cat [pwd]/run1 eql.sum run1/@pept/type_@type/run@i --combine i orientation --save [pwd]/data]

## Do histgram analysis on each concatenated file. 
# COM is the variable used to construct the histgram. The range of COM is from 10 to 30 and is divided into 40 bins.
# The result files are saved with an extension name .COM.
foreach r $result {
    set fname [dict get $r fname]
    puts $fname
    set title [read_title $fname]
    win_ave_file $fname COM 10 30 40 $title $fname.COM
}

